package site.yunnong.atvris.portal.spider.v191;

import com.geccocrawler.gecco.pipeline.Pipeline;
import com.geccocrawler.gecco.request.HttpGetRequest;
import com.geccocrawler.gecco.scheduler.DeriveSchedulerContext;

/**
 * @author zjh
 * @date 2021/8/28 17:13
 */
public class V191PagePipeline implements Pipeline<V191Page> {
    
    @Override
    public void process(V191Page v191Page) {
        for (VideoInfo videoInfo : v191Page.getVideoInfoList()) {
            // substring 封面url处理
            String newImageUrl = videoInfo.getImageUrl().substring(videoInfo.getImageUrl().indexOf("(") + 1, videoInfo.getImageUrl().indexOf(")"));
            videoInfo.setImageUrl(newImageUrl);
            // 派生
            HttpGetRequest request = new HttpGetRequest(videoInfo.getVideoDetailUrl());
            request.addParameter("imageUrl", videoInfo.getImageUrl());
            DeriveSchedulerContext.into(request);
        }
//        System.out.println(JSON.toJSONString(v191PageGecco));
        
        
    }
}
